
%Declare the symbolic variables (syms)
syms shksVal eeVal lb0Val lg0Val phiVal 

f=shksVal-eeVal*(lb0Val+lg0Val)/(phiVal*vartheta*(lb0Val*(xib+1/vartheta*(1-xib))+lg0Val*(1-xib))); 

%Take symbolic derivatives
dd1 = diff(f,shksVal);   %dd1 = diff(f,shkpVal);
dd2 = diff(f,eeVal);
dd3 = diff(f,lb0Val);
dd4 = diff(f,lg0Val);
dd5 = diff(f,phiVal);
%dd6 = diff(f,xibVal);

%Evaluates symbolic derivatives

shksVal=s;  %linearize
eeVal=EEstar;  %linearize
lb0Val=lb0;  %linearize
lg0Val=lg0;  %linearize
phiVal=phi0;  %linearize   % Renato modified 21/12
%xibVal=xib;  %linearize 

D1=subs(dd1);
D2=subs(dd2);
D3=subs(dd3);
D4=subs(dd4);
D5=subs(dd5);
%D6=subs(dd6);

% Transform symbolic into numbers (with double precision)
d1=double(D1);
d2=double(D2);
d3=double(D3);
d4=double(D4);
d5=double(D5);
%d6=double(D6);


ACont(14,shksLog)   = -d1;
ACont(14,eeLog) = -d2;
ACont(14,lb0Log)    = -d3; 
ACont(14,lg0Log)     = -d4; 
ACont(14,phiLog)   = -d5;
%ACont(14,shkxibLog)   = -d6;
